<?php
class Vina_View_Helper_TreeMenu extends Zend_View_Helper_Abstract
{
    public function TreeMenu($parentid = 0,$space = '- ', $trees = NULL){ 
        $modelCat = new Vina_Model_Categories();
        if(!$trees) $trees = array(); 
        $dataCategory = $modelCat->fetchListToArray("category_id = $parentid", "id desc");
        
        foreach($dataCategory as $rs){
        $trees[] = array('id'=>$rs['category_id'],'title'=>$space.$rs['name']); 
        $trees = $this->TreeMenu($rs['id'],$space.'--> ',$trees); 
        } 
        return $trees; 
     } 
}